package RegionPartition;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

public class RegionPartition extends Partitioner<Text, RegionPartitionFlowBean> {
    @Override
    public int getPartition(Text text, RegionPartitionFlowBean flowBean, int i) {
        int regionCode = flowBean.getRegionCode();
        int partition = 6;

        if(regionCode>40)
            partition = 0;
        else if(regionCode>30)
            partition = 1;
        else if(regionCode>20)
            partition = 2;
        else if(regionCode>10)
            partition = 3;
        else if(regionCode>5)
            partition = 4;
        else
            partition = 5;

        return partition;
    }
}
